Skip to content

Remove self-citations from documentation #387

Remove self-citations from documentation

Remove self-citations from documentation #387

name: Comprehensive Validation (MATLAB + Julia)
on:
push:
pull_request:
workflow_dispatch:
jobs:
# Job 1: Ensure MATLAB golden files are up to date
validate-matlab:
name: Validate MATLAB Implementation
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup MATLAB
uses: matlab-actions/setup-matlab@v2
with:
cache: true
products: Parallel_Computing_Toolbox
- name: Check golden files exist
run: |
echo "Checking MATLAB golden files..."
ls -lh goldenfiles/
file_count=$(ls -1 goldenfiles/goldenfile_*.mat 2>/dev/null | wc -l)
echo "Found $file_count golden files"
if [ "$file_count" -lt 1 ]; then
echo "FAIL No golden files found!"
exit 1
fi
echo "OK Golden files present"
- name: Run MATLAB tests
uses: matlab-actions/run-command@v2
with:
command: |
cd legacy/3D_MATLAB/tests
exit_code = run_all_tests();
if exit_code ~= 0
error('MATLAB tests failed');
end
fprintf('OK MATLAB tests passed\n');
- name: Verify golden file integrity
uses: matlab-actions/run-command@v2
with:
command: |
% Load and validate golden file structure
golden_file = 'goldenfiles/goldenfile_mpi_1ranks_Np20_tmax100.mat';
if ~exist(golden_file, 'file')
error('Golden file not found: %s', golden_file);
end
data = load(golden_file);
if ~isfield(data, 'golden_data')
error('Invalid golden file structure: missing golden_data');
end
gd = data.golden_data;
% New nested structure: moments, parameters, grid, metadata
required_top_fields = {'moments', 'parameters', 'grid', 'metadata'};
for i = 1:length(required_top_fields)
if ~isfield(gd, required_top_fields{i})
error('Missing top-level field: %s', required_top_fields{i});
end
end
% Check nested fields
if ~isfield(gd.moments, 'M')
error('Missing moments.M');
end
if ~isfield(gd.parameters, 'Np') || ~isfield(gd.parameters, 'tmax') || ~isfield(gd.parameters, 'time_steps')
error('Missing required parameters fields');
end
M = gd.moments.M;
fprintf('Golden file validation:\n');
fprintf(' Size: %dx%dx%d\n', size(M));
fprintf(' Np: %d\n', gd.parameters.Np);
fprintf(' tmax: %.2f\n', gd.parameters.tmax);
fprintf(' Final time: %.6f\n', gd.parameters.final_time);
fprintf(' Time steps: %d\n', gd.parameters.time_steps);
fprintf(' Created: %s\n', gd.metadata.creation_date);
fprintf(' Branch: %s\n', gd.metadata.git_branch);
fprintf('OK Golden file structure validated\n');
# Job 2: Test Julia against MATLAB golden files
validate-julia:
name: Validate Julia vs MATLAB Golden Files
needs: validate-matlab # Only run if MATLAB validation passes
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
test-type: ['unit', 'golden', 'mpi']
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
- name: Setup Julia
uses: julia-actions/setup-julia@v2
with:
version: '1.10' # Use 1.10 (1.12 has OpenSSL_jll issues on GH Actions)
arch: x64
- name: Install MPI
run: |
sudo apt-get update
sudo apt-get install -y mpich libmpich-dev
mpiexec --version
- name: Remove GLMakie (headless CI environment)
# Package now at root
env:
HYQMOM_SKIP_PLOTTING: "true"
run: |
echo "Removing GLMakie to avoid X11/GLFW errors in CI..."
# Remove GLMakie from Project.toml in multiple sections
if grep -q "GLMakie" Project.toml; then
echo "Found GLMakie in Project.toml, removing from all sections..."
# Remove from [deps]
sed -i '/^GLMakie = /d' Project.toml
# Remove from [compat]
sed -i '/^GLMakie = /d' Project.toml
# Remove GLMakie from [targets] test array
sed -i 's/, "GLMakie"//g' Project.toml
sed -i 's/"GLMakie", //g' Project.toml
sed -i 's/"GLMakie"//g' Project.toml
echo "GLMakie removed from Project.toml"
echo "Modified Project.toml:"
cat Project.toml
else
echo "GLMakie not found in Project.toml"
fi
# Remove Manifest to force clean resolve
if [ -f Manifest.toml ]; then
echo "Cleaning Manifest.toml to force re-resolve..."
rm -f Manifest.toml
fi
echo "Ready to install without GLMakie"
- name: Install dependencies
# Package now at root
env:
HYQMOM_SKIP_PLOTTING: "true"
run: |
julia --project --color=yes -e '
using Pkg
println("Julia version: ", VERSION)
println("Project: ", Base.active_project())
println()
# Update registry
println("Updating package registry...")
try
Pkg.Registry.update()
println("OK Registry updated")
catch e
@warn "Registry update failed, continuing anyway" exception=(e, catch_backtrace())
end
println()
# Install packages
println("Installing packages...")
Pkg.instantiate(verbose=true)
println()
println("Resolving dependencies...")
Pkg.resolve()
println()
println("Precompiling packages...")
Pkg.precompile()
println()
println("Package status:")
Pkg.status()
println()
println("OK All packages installed successfully")
'
# Build MPI separately
julia --project -e '
using Pkg
Pkg.build("MPI", verbose=true)
using MPI
println("OK MPI.jl ready")
'
- name: Run unit tests
if: matrix.test-type == 'unit'
# Package now at root
run: |
julia --project --color=yes -e 'using Pkg; Pkg.test()'
- name: Run golden file test
if: matrix.test-type == 'golden'
# Package now at root
run: |
echo "=================================================================="
echo "GOLDEN FILE TEST: Julia vs MATLAB"
echo "=================================================================="
julia --project test/test_golden_files.jl
exit_code=$?
if [ $exit_code -eq 0 ]; then
echo "OK Golden file test PASSED"
else
echo "FAIL Golden file test FAILED"
exit 1
fi
- name: Run MPI golden file test
if: matrix.test-type == 'mpi'
# Package now at root
run: |
echo "=================================================================="
echo "MPI GOLDEN FILE TEST: Julia vs MATLAB (1 rank)"
echo "=================================================================="
mpiexec -n 1 julia --project test/test_golden_files.jl
exit_code=$?
if [ $exit_code -eq 0 ]; then
echo "OK MPI golden file test PASSED"
else
echo "FAIL MPI golden file test FAILED"
exit 1
fi
- name: Generate comparison report
if: always() && matrix.test-type == 'golden'
# Package now at root
run: |
julia --project -e '
println("="^70)
println("JULIA vs MATLAB COMPARISON SUMMARY")
println("="^70)
println()
println("Environment:")
println(" Julia version: ", VERSION)
println(" OS: ", Sys.KERNEL, " ", Sys.ARCH)
println()
println("Golden file test compares:")
println(" OK Grid size: 20x20")
println(" OK Time range: 0.0 -> 0.1")
println(" OK Moments: 35 components")
println(" OK MPI ranks: 1")
println()
println("Expected results:")
println(" Max absolute error: < 1e-8")
println(" Max relative error: < 1e-6")
println(" Typical agreement: ~1e-15 (machine precision)")
println("="^70)
'